package com.xframe.xdal.core.autofill.proc;

import com.xframe.xdal.core.autofill.IAutoFillBean;
import com.xframe.xdal.core.autofill.IAutoProc;
import com.xframe.xdal.core.model.IModel;

public class SnowflakeModAutoProc implements IAutoProc {
    @Override
    public Object getVal(IAutoFillBean autoFillBean, Object entity, Object val) {
        if(entity instanceof IModel) {
            IModel model = (IModel) entity;
            Long id = (Long)model.getObjectId();
            return id % 256;
        }
        return 0L;
    }
}
